CREATE TABLE [dbo].[tb_RegistroAuditoria]
(
[idRegistroAuditoria] [int] NOT NULL IDENTITY(1, 1),
[idAuditoria] [int] NOT NULL,
[fecha] [datetime] NOT NULL,
[idUsuario] [int] NOT NULL,
[Descripcion] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[dirIP] [varchar] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_RegistroAuditoria] ADD CONSTRAINT [PK_tb_RegistroAuditoria] PRIMARY KEY NONCLUSTERED  ([idRegistroAuditoria]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_RegistroAuditoria] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroAuditoria_tb_Auditoria] FOREIGN KEY ([idAuditoria]) REFERENCES [dbo].[tb_Auditoria] ([idAuditoria]) NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[tb_RegistroAuditoria] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroAuditoria_tb_DetalleAuditoria] FOREIGN KEY ([idRegistroAuditoria]) REFERENCES [dbo].[tb_DetalleAuditoria] ([idDetalleAuditoria]) NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[tb_RegistroAuditoria] WITH NOCHECK ADD CONSTRAINT [FK_tb_RegistroAuditoria_tb_Usuarios] FOREIGN KEY ([idUsuario]) REFERENCES [dbo].[tb_Usuarios] ([idUsuario]) NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[tb_RegistroAuditoria] NOCHECK CONSTRAINT [FK_tb_RegistroAuditoria_tb_Auditoria]
GO
ALTER TABLE [dbo].[tb_RegistroAuditoria] NOCHECK CONSTRAINT [FK_tb_RegistroAuditoria_tb_DetalleAuditoria]
GO
ALTER TABLE [dbo].[tb_RegistroAuditoria] NOCHECK CONSTRAINT [FK_tb_RegistroAuditoria_tb_Usuarios]
GO
